<%-- 
    Document   : billingproductdb
    Created on : Jan 14, 2013, 11:06:36 PM
    Author     : Bittuji
--%>

<%@page import="org.omg.PortableInterceptor.SYSTEM_EXCEPTION"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@include file="db.jsp"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <%
        
        String bill = request.getParameter("billno");
        String bptid = request.getParameter("bptid");
        String ptid = request.getParameter("ptid");
        int qty = Integer.parseInt(request.getParameter("qty"));
        float price = Float.parseFloat(request.getParameter("price"));
        float disc = Float.parseFloat(request.getParameter("disc"));
        String disctype = request.getParameter("disctype");
        float total = Float.parseFloat(request.getParameter("total"));
        
        
        String sql = "INSERT INTO `billing_product`(`id`, `bill_no`, `product_id`, `party_id`, `quantity`, `price`, `discount`, `discount_type`, `sub_total`) VALUES (?,?,?,?,?,?,?,?,?)";
        
        PreparedStatement pstmt = con.prepareStatement(sql);
        
        pstmt.setNull(1, java.sql.Types.INTEGER);
        pstmt.setString(2, bill);
        pstmt.setString(3, bptid);
        pstmt.setString(4, ptid);
        pstmt.setInt(5, qty);
        pstmt.setFloat(6, price);
        pstmt.setFloat(7, disc);
        pstmt.setString(8, disctype);
        pstmt.setFloat(9, total);
        
        int result = pstmt.executeUpdate();
        
        if(result==1)
            System.out.println("DATA INSERTED");
        
        
        %>
    </body>
</html>
